Method for scanning transform coefficient and device therefor

ABSTRACT

Provided is a transform coefficient scan method including: determining a reference transform block for a decoding target block; deriving a scanning map of the decoding target block using scanning information of the reference transform block; and performing inverse scanning on a transform coefficient of the decoding target block using the derived scanning map. According to the present invention, picture encoding/decoding efficiency may be improved.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.17/377,057 filed on Jul. 15, 2021, which is a continuation of U.S.patent application Ser. No. 14/001,204 filed on Aug. 23, 2013, nowissued as U.S. Pat. No. 11,102,494, which is a National Stageapplication of International Application No. PCT/KR2012/001618 filedMar. 5, 2012, which claims benefit under 35 U.S.C. § 119(a) of KoreanPatent Applications Nos. 10-2012-0019155 filed on Mar. 3, 2011, and10-2012-0022496 filed on Mar. 5, 2012 in the Korean IntellectualProperty Office, the contents of all of which are incorporated herein byreference in their entireties. The applicant(s) hereby rescind anydisclaimer of claim scope in the parent application(s) or theprosecution history thereof and advise the USPTO that the claims in thisapplication may be broader than any claim in the parent application(s).

TECHNICAL FIELD

The present invention relates to picture processing, and moreparticularly, to a transform coefficient scanning method and apparatus.

BACKGROUND

Recently, in accordance with the expansion of broadcasting serviceshaving high definition (HD) resolution in the country and around theworld, many users have been accustomed to a high resolution and highdefinition picture, such that many organizations have attempted todevelop the next-generation picture devices. In addition, as theinterest in HDTV and ultra high definition (UHD) having a resolutionfour times higher than that of HDTV have increased, a compressiontechnology for a higher-resolution and higher-definition picture hasbeen demanded.

As the picture compression technology, there are an inter predictiontechnology of predicting pixel values included in a current picture froma picture before and/or after the current picture, an intra predictiontechnology of predicting pixel values included in a current pictureusing pixel information in the current picture, a transform technologyof decomposing an original picture signal into a signal of a frequencydomain, an inverse transform technology of reconstructing a signal of afrequency domain into an original picture signal, an entropy-encodingtechnology of allocating a short code to symbols having a highappearance frequency and a long code to symbols having a low appearancefrequency, and the like.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing a configuration of a picture encodingapparatus according to an exemplary embodiment of the present invention.

FIG. 2 is a block diagram showing a configuration of a picture decodingapparatus according to an exemplary embodiment of the present invention.

FIG. 3 is a conceptual diagram schematically showing an example in whicha single block is divided into a plurality of sub-blocks.

FIG. 4 is a flow chart schematically showing an example of a method ofscanning a transform coefficient in an encoder according to an exemplaryembodiment of the present invention.

FIG. 5 is a flow chart schematically showing an example of a method ofscanning a transform coefficient in a decoder according to an exemplaryembodiment of the present invention.

FIG. 6 is a conceptual diagram schematically showing an example of amethod of selecting reference transform block according to an exemplaryembodiment of the present invention.

FIG. 7 is a conceptual diagram schematically showing another example ofa method of selecting a reference transform block according to anexemplary embodiment of the present invention.

FIG. 8 is a conceptual diagram schematically showing still anotherexample of a method of selecting a reference transform block accordingto an exemplary embodiment of the present invention.

FIG. 9 is a conceptual diagram schematically showing still anotherexample of a method of selecting a reference transform block accordingto an exemplary embodiment of the present invention.

FIG. 10 is a conceptual diagram schematically showing still anotherexample of a method of selecting a reference transform block accordingto an exemplary embodiment of the present invention.

FIG. 11 is a conceptual diagram schematically showing still anotherexample of a method of selecting a reference transform block accordingto an exemplary embodiment of the present invention.

FIG. 12 is a flow chart schematically showing an example of a method ofderiving a scanning map for an encoding target block.

FIG. 13 is a conceptual diagram schematically showing an example of amethod of determining a transform coefficient flag value according to anexemplary embodiment of the present invention.

FIG. 14 is a conceptual diagram schematically showing another example ofa method of determining a transform coefficient flag value according toan exemplary embodiment of the present invention.

FIG. 15 is a conceptual diagram schematically showing an example of amethod of deriving a transform coefficient counter map according to anexemplary embodiment of the present invention.

FIG. 16 is a conceptual diagram schematically showing an example of amethod of generating a scanning map according to an exemplary embodimentof the present invention.

FIG. 17 is a conceptual diagram schematically showing an example of amethod of scanning/inverse scanning a transform coefficient of anencoding target block using a scanning map.

BRIEF SUMMARY OF INVENTION Technical Problem

The present invention provides a picture encoding method and apparatuscapable of improving picture encoding/decoding efficiency.

The present invention also provides a picture decoding method andapparatus capable of improving picture encoding/decoding efficiency.

The present invention also provides a transform coefficient scanningmethod and apparatus capable of improving picture encoding/decodingefficiency.

Technical Solution

1. In an aspect, a transform coefficient scan method is provided. Thetransform coefficient scan method includes: determining a referencetransform block for a decoding target block; deriving a scanning map ofthe decoding target block using scanning information of the referencetransform block; and performing inverse scanning on a transformcoefficient of the decoding target block using the derived scanning map.

2. In 1, in the determining of the reference transform block, a blockpresent at a position that is the spatially same as that of the decodingtarget block in a reference picture may be determined as the referencetransform block.

3. In 1, in the determining of the reference transform block, at leastone of reconstructed neighboring blocks may be determined as thereference transform block, wherein the reconstructed neighboring blocksincludes an upper neighboring block adjacent to an upper portion of thedecoding target block, a left neighboring block adjacent to the left ofthe decoding target block, a right upper corner block positioned at aright upper corner of the decoding target block, a left upper cornerblock positioned at a left upper corner of the decoding target block,and a left lower corner block positioned at a left lower cornet of thedecoding target block.

4. In 3, in the determining of the reference transform block, a blockhaving the same size as that of the decoding target block may bedetermined as the reference transform block.

5. In 3, in the determining of the reference transform block, a blockhaving the same depth as that of the decoding target block may bedetermined as the reference transform block.

6. In 3, in the determining of the reference transform block, a blockhaving the same encoding parameter as that of the decoding target blockmay be determined as the reference transform block, wherein the encodingparameter includes at least one of information on an intra predictiondirection, a reference picture list, a reference picture index, a motionvector predictor, whether or not a motion information merge is used,whether or not a skip mode is used, a transform kind.

7. In 1, the deriving of the scanning map may include: determiningtransform coefficient flag values for positions of each transformcoefficient in the reference transform block; deriving a counter map forthe decoding target block by calculating flag counter values for thepositions of each transform coefficient in the reference transform blockbased on the transform coefficient flag; and generating the scanning mapby allocating scan indices to positions of each transform coefficient inthe counter map in an ascending order in a sequence in which the flagcounter value is high one by one, wherein the transform coefficient flagis a flag indicating whether or not each transform coefficient in thereference transform block is a non-zero transform coefficient, and theflag counter is the sum of the transform coefficient flag values presentat the same position in the case in which all of the reference transformblocks are overlapped with each other.

8. In 7, in the case in which a size of the reference transform block isdifferent from that of the decoding target block, the determining of thetransform coefficient flag values may include: scaling the referencetransform block; and determining transform coefficient flag values forpositions of each transform coefficient in the scaled referencetransform block, and the deriving of the counter map may includederiving the counter map based on the transform coefficient flag in thescaled reference transform block.

9. In 7, in the generating of the scanning map, the scan indices may beallocated based on a zigzag scan sequence.

10. In another aspect, a picture decoding apparatus is provided. Thepicture decoding apparatus includes: an inverse scanning unitdetermining a reference transform block for a decoding target block,deriving a scanning map of the decoding target block using scanninginformation of the reference transform block, and performing inversescanning on a transform coefficient of the decoding target block usingthe derived scanning map; and a reconstructed picture generating unitgenerating a reconstructed picture based on the inversely scannedtransform coefficient.

11. In still another aspect, a picture decoding method is provided. Thepicture decoding method includes: determining a reference transformblock for a decoding target block; deriving a scanning map of thedecoding target block using scanning information of the referencetransform block; performing inverse scanning on a transform coefficientof the decoding target block using the derived scanning map; andgenerating a reconstructed picture based on the inversely scannedtransform coefficient.

12. In 11, the deriving of the scanning map may include: determiningtransform coefficient flag values for positions of each transformcoefficient in the reference transform block; deriving a counter map forthe decoding target block by calculating flag counter values for thepositions of each transform coefficient in the reference transform blockbased on the transform coefficient flag; and generating the scanning mapby allocating scan indices to positions of each transform coefficient inthe counter map in an ascending order in a sequence in which the flagcounter value is high one by one, wherein the transform coefficient flagis a flag indicating whether or not each transform coefficient in thereference transform block is a non-zero transform coefficient, and theflag counter is the sum of the transform coefficient flag values presentat the same position in the case in which all of the reference transformblocks are overlapped with each other.

13. In 12, in the case in which a size of the reference transform blockis different from that of the decoding target block, the determining ofthe transform coefficient flag values may include: scaling the referencetransform block; and determining transform coefficient flag values forpositions of each transform coefficient in the scaled referencetransform block, and the deriving of the counter map may includederiving the counter map based on the transform coefficient flag in thescaled reference transform block.

14. In 12, in the generating of the scanning map, the scan indices maybe allocated based on a zigzag scan sequence.

Advantageous Effects

With the picture encoding method according to the exemplary embodimentof the present invention, picture encoding/decoding efficiency may beimproved.

With the picture decoding method according to the exemplary embodimentof the present invention, picture encoding/decoding efficiency may beimproved.

With the transform coefficient scanning method according to theexemplary embodiment of the present invention, picture encoding/decodingefficiency may be improved.

DETAILED DESCRIPTION Mode for Invention

Hereinafter, exemplary embodiments of the present invention will bedescribed in detail with reference to the accompanying drawings. Indescribing exemplary embodiments of the present invention, well-knownfunctions or constructions will not be described in detail since theymay unnecessarily obscure the understanding of the present invention.

It will be understood that when an element is simply referred to asbeing ‘connected to’ or ‘coupled to’ another element without being‘directly connected to’ or ‘directly coupled to’ another element in thepresent description, it may be ‘directly connected to’ or ‘directlycoupled to’ another element or be connected to or coupled to anotherelement, having the other element intervening therebetween. Further, inthe present invention, “comprising” a specific configuration will beunderstood that additional configuration may also be included in theembodiments or the scope of the technical idea of the present invention.

Terms used in the specification, ‘first’, ‘second’, etc. can be used todescribe various components, but the components are not to be construedas being limited to the terms. The terms are only used to differentiateone component from other components. For example, the ‘first’ componentmay be named the ‘second’ component and the ‘second’ component may alsobe similarly named the ‘first’ component, without departing from thescope of the present invention.

Furthermore, constitutional parts shown in the embodiments of thepresent invention are independently shown so as to represent differentcharacteristic functions. Thus, it does not mean that eachconstitutional part is constituted in a constitutional unit of separatedhardware or one software. In other words, each constitutional partincludes each of enumerated constitutional parts for convenience ofexplanation. Thus, at least two constitutional parts of eachconstitutional part may be combined to form one constitutional part orone constitutional part may be divided into a plurality ofconstitutional parts to perform each function. The embodiment where eachconstitutional part is combined and the embodiment where oneconstitutional part is divided are also included in the scope of thepresent invention, if not departing from the essence of the presentinvention.

In addition, some of constituents may not be indispensable constituentsperforming essential functions of the present invention but be selectiveconstituents improving only performance thereof. The present inventionmay be implemented by including only the indispensable constitutionalparts for implementing the essence of the present invention except theconstituents used in improving performance. The structure including onlythe indispensable constituents except the selective constituents used inimproving only performance is also included in the scope of the presentinvention.

FIG. 1 is a block diagram showing a configuration of a picture encodingapparatus according to an exemplary embodiment of the present invention.

Referring to FIG. 1 , a picture encoding apparatus 100 includes a motionestimator 111, a motion compensator 112, an intra predictor 120, aswitch 115, a subtracter 125, a transformer 130, a quantizer 140, anentropy-encoder 150, a dequantizer 160, an inverse transformer 170, anadder 175, a filter unit 180, and a reference picture buffer 190.

The picture encoding apparatus 100 may perform encoding on inputpictures in an intra-mode or an inter-mode and output bit streams. Inthe case of the intra mode, the switch 115 may be switched to intra, andin the case of the inter mode, the switch 115 may be switched to inter.The picture encoding apparatus 100 may generate a prediction block foran input block of the input pictures and then encode a residual betweenthe input block and the prediction block.

In the case of the intra mode, the intra predictor 120 may performspatial prediction using pixel values of blocks encoded in advancearound a current block to generate the prediction block.

In the case of the inter mode, the motion estimator 111 may search aregion optimally matched with the input block in a reference picturestored in the reference picture buffer 190 during a motion predictionprocess to obtain a motion vector. The motion compensator 112 mayperform motion compensation using the motion vector to generate theprediction block.

The subtracter 125 may generate a residual block by the residual betweenthe input block and the generated prediction block. The transformer 130may perform transform on the residual block to output transformcoefficients. Here, the transform coefficient means a coefficient valuegenerated by performing transform on the residual block and/or aresidual signal. Hereinafter, in the present specification, quantizationis applied to the transform coefficient, such that a quantized transformcoefficient level may also be called a transform coefficient.

The quantizer 140 may quantize the input transform coefficient accordingto quantization parameters to output a quantized transform coefficientlevel.

The entropy-encoder 150 may perform entropy-encoding based on valuescalculated in the quantizer 140 or encoding parameter values, or thelike, calculated during the encoding process to output bit streams.

When the entropy-encoding is applied, symbols are represented byallocating a small number of bits to symbols having high generationprobability and allocating a large number of bits to symbols having lowgeneration probability, thereby making it possible to reduce a size ofbit streams for the encoding target symbols. Therefore, the compressionperformance of the picture encoding may be improved through theentropy-encoding. The entropy-encoder 150 may use an encoding methodsuch as exponential golomb, context-adaptive variable length coding(CAVLC), context-adaptive binary arithmetic coding (CABAC), or the like,for the entropy-encoding.

Since the picture encoding apparatus according to the exemplaryembodiment of FIG. 1 performs inter prediction encoding, that is,inter-picture prediction encoding, a current encoded picture needs to bedecoded and stored in order to be used as a reference picture.Therefore, the quantized coefficient is dequantized in the dequantizer160 and inversely transformed in the inverse transformer 170. Thedequantized and inversely transformed coefficient is added to theprediction block through the adder 175, such that a reconstructed blockis generated.

The reconstructed block passes through the filter unit 180 and thefilter unit 180 may apply at least one of a deblocking filter, a sampleadaptive offset (SAO), and an adaptive loop filter (ALF) to areconstructed block or a reconstructed picture. The reconstructed blockpassing through the filter unit 180 may be stored in the referencepicture buffer 190.

FIG. 2 is a block diagram showing a configuration of a picture decodingapparatus according to an exemplary embodiment of the present invention.

Referring to FIG. 2 , a picture decoding apparatus 200 includes anentropy-decoder 210, a dequantizer 220, an inverse transformer 230, anintra predictor 240, a motion compensator 250, an adder 255, a filterunit 260, and a reference picture buffer 270.

The picture decoding apparatus 200 may receive the bit streams outputfrom the encoder to perform the decoding in the intra mode or the intermode and output the reconstructed picture, that is, a recovered picture.In the case of the intra mode, the switch may be switched to the intra,and in the case of the inter mode, the switch may be switched to theinter. The picture decoding apparatus 200 may obtain a reconstructedresidual block from the received bit streams, generate the predictionblock, and then add the reconstructed residual block to the predictionblock to generate the reconstructed block, that is, a recovered block.

The entropy-decoder 210 may entropy-decode the input bit streamsaccording to the probability distribution to generate symbols includinga quantized coefficient type of symbols. The entropy-decoding method issimilar to the above-mentioned entropy encoding method.

When the entropy-decoding method is applied, symbols are represented byallocating a small number of bits to symbols having high generationprobability and allocating a large number of bits to symbols having lowgeneration probability, thereby making it possible to reduce a size ofbit streams for each symbol. Therefore, the picture decoding compressionperformance may be improved through the entropy-decoding method.

The quantized coefficients may be dequantized in the dequantizer 220 andbe inversely transformed in the inverse transformer 230. The quantizedcoefficients are dequantized/inversely transformed, such that thereconstructed residual block may be generated.

In the case of the intra mode, the intra predictor 240 may performspatial prediction using pixel values of blocks encoded in advancearound a current block to generate the prediction block. In the case ofthe inter mode, the motion compensator 250 may perform the motioncompensation using the motion vector and the reference picture stored inthe reference picture buffer 270 to generate the prediction block.

The reconstructed residual block and the prediction block may be addedto each other through the adder 255 and the added block may pass throughthe filter unit 260. The filter unit 260 may apply at least one of thedeblocking filter, the SAO, and the ALF to the reconstructed block orthe reconstructed picture. The filter unit 260 may output thereconstructed picture, that is, a recovered picture. The reconstructedpicture may be stored in the reference picture buffer 270 to thereby beused for the inter prediction.

Hereinafter, a block means a unit of picture encoding and decoding. Atthe time of the picture coding and decoding, since the encoding ordecoding unit means the divided unit when dividing the picture andencoding or decoding the divided pictures, the encoding or decoding unitmay be called a macro block, a coding unit (CU), a transform unit (TU),a transform block, or the like. In addition, hereinafter, anencoding/decoding target block means the transform unit and/or thetransform block. A single block may be subdivided into sub-blocks havinga smaller size.

FIG. 3 is a conceptual diagram schematically showing an example in whicha single block is divided into a plurality of sub-blocks.

A single block may be hierarchically divided using depth or depth levelinformation based on a tree structure. The respective divided sub-blocksmay have a depth value. Here, the depth may indicate the number and/orthe degree of divisions of the depth block. Therefore, the depth valuemay also include information on a size of the sub-block.

Referring to 310 of FIG. 3 , an uppermost node may be called a root nodeand have a smallest depth value. Here, the uppermost node may have adepth of level 0 and indicate an initial block that is not divided.

A lower node having a depth of level 1 may indicate a block divided oncefrom the initial block, and a lower node having a depth of level 2 mayindicate a block divided twice from the initial block. For example, in320 of FIG. 3 , a block a corresponding to a node a may be a blockdivided once from the initial block and have a depth of level 1.

A leaf node of level 3 may indicate a block divided three times from theinitial block. For example, in 320 of FIG. 3 , a block d correspondingto a node d may be a block divided three times from the initial blockand have a depth of level 3. The leaf node of level 3, which is alowermost node, may have a deepest depth.

Meanwhile, as described above, the encoder may perform transform on theresidual block generated after performing the inter prediction and theintra prediction to generate the transform coefficient. Whenquantization is performed on the transform coefficient, the quantizedtransform coefficient level may be generated.

In the case of the quantized transform coefficient level, it is likelythat a non-zero transform coefficient will be distributed in a lowfrequency region due to characteristics of transform. Here, the non-zerotransform coefficient means a transform coefficient having a non-zerovalue and/or a transform coefficient level having a non-zero value.Therefore, in order to preferentially encode the non-zero transformcoefficient level present in the low frequency region, the encoder mayperform scanning before performing entropy-encoding on the transformcoefficient level in the encoding target block. Here, the scanning meansa process of aligning a sequence of transform coefficients in thetransform unit and/or the transform block. As a generally used scanningmethod, there are a zigzag scan method, a field scan method, and thelike.

The decoder may perform entropy-decoding on the transform coefficientlevel at the time of decoding the picture. Before dequantization andinverse transform are performed on the entropy-decoded transformcoefficient level, the decoder may perform inverse scanning in order todetermine a position of the decoding target block in which the transformcoefficient level is to be included.

In an existing scanning/inverse scanning method, since characteristicsof neighboring blocks, or the like, having characteristics similar tothose of the encoding/decoding target block are not sufficiently used,there may be a limitation in improving encoding efficiency. Therefore,in order to improve the encoding efficiency, a picture encoding/decodingmethod and apparatus of selecting a reference transform block in acontext-adaptive scheme and performing scanning/inverse scanning on atransform coefficient of an encoding/decoding target block usingscanning/inverse scanning information of the reference transform blockmay be provided.

FIG. 4 is a flow chart schematically showing an example of a method ofscanning a transform coefficient in an encoder according to an exemplaryembodiment of the present invention.

Referring to FIG. 4 , the encoder may select a reference transform blockfor an encoding target block (S410). At this time, the encoder mayselect blocks other than the encoding target block as the referencetransform block, and a size of the selected reference transform blockmay be N*M (N and M indicate any natural number).

The selected reference transform block may include scanning information.Therefore, the encoder may obtain the scanning information from theselected reference transform block. Here, the scanning information mayinclude a position of a non-zero transform coefficient in the selectedreference transform block, a value of the transform coefficient of theselected reference transform block, and the like. Examples of a methodof selecting a reference transform block will be described below.

Again referring to FIG. 4 , the encoder may derive a scanning map forthe encoding target block using the scanning information on thereference transform block (S420).

In the selecting of the reference transform block described above, thenumber of selected reference transform blocks may be one or two oremore. In the case in which two or more reference transform blocks areselected, the encoder may derive the scanning map using the scanninginformation of the selected two or more reference transform blocks.

In the selecting of the reference transform block described above, thereference transform block may not also be selected. In the case in whichthe selected reference transform block is not present, the encoder maydetermine a predetermined fixed scanning map as a scanning map for theencoding target block. Here, the predetermined fixed scanning map may bea scanning map indicating zigzag scan. Further, in the case in which theselected reference transform block is not present, the encoder may alsoomit a process of determining the scanning map and perform scanning onthe encoding target block using a predetermined fixed scanning method.Here, the predetermined fixed scanning method may be zigzag scan.

A specific example of a method of deriving the scanning map for theencoding target block using the scanning information of the referencetransform block will be described below.

Again referring to FIG. 4 , the encoder may perform scanning on atransform coefficient of the encoding target block using the derivedscanning map (S430). An example of a method of scanning the transformcoefficient of the encoding target block will be described below.

FIG. 5 is a flow chart schematically showing an example of a method ofscanning a transform coefficient in a decoder according to an exemplaryembodiment of the present invention.

Referring to FIG. 5 , the decoder may select a reference transform blockfor a decoding target block (S510). At this time, the decoder may selectblocks other than the decoding target block as the reference transformblock, and a size of the selected reference transform block may be N*M(N and M indicate any natural number).

The selected reference transform block may include scanning information.Therefore, the decoder may obtain the scanning information from theselected reference transform block. Here, the scanning information mayinclude a position of a non-zero transform coefficient in the selectedreference transform block, a value of the transform coefficient of theselected reference transform block, and the like. The decoder may selectthe reference transform block using the same method as the method usedin the encoder, and examples of a method of selecting the referencetransform block will be described below.

Again referring to FIG. 5 , the decoder may derive a scanning map forthe decoding target block using the scanning information on thereference transform block (S520).

In the selecting of the reference transform block described above, thenumber of selected reference transform blocks may be one or two oremore. In the case in which two or more reference transform blocks areselected, the decoder may derive the scanning map using the scanninginformation of the selected two or more reference transform blocks.

In the selecting of the reference transform block described above, thereference transform block may not also be selected. In the case in whichthe selected reference transform block is not present, the decoder maydetermine a predetermined fixed scanning map as a scanning map for thedecoding target block. Here, the predetermined fixed scanning map may bea scanning map indicating zigzag scan. Further, in the case in which theselected reference transform block is not present, the decoder may alsoomit a process of determining the scanning map and perform inversescanning on the decoding target block using a predetermined fixedscanning method. Here, the predetermined fixed scanning method may bezigzag scan.

A method of deriving the scanning map for the decoding target block maybe the same as the method of deriving the scanning map in the encoder. Aspecific example of a method of deriving the scanning map for thedecoding target block using the scanning information of the referencetransform block will be described below.

Again referring to FIG. 5 , the decoder may perform inverse scanning ona transform coefficient of the decoding target block using the derivedscanning map (S530). An example of a method of inversely scanning thetransform coefficient of the encoding target block will be describedbelow.

Hereinafter, the following examples will be described based on theencoder for convenience. However, unless particularly stated, they mayalso be applied to the decoder in the same scheme. In this case, theencoding target block may be interpreted as being the decoding targetblock, and the scanning may be interpreted as being inverse scanning.

FIG. 6 is a conceptual diagram schematically showing an example of amethod of selecting reference transform block according to an exemplaryembodiment of the present invention.

The encoder may select reconstructed neighboring blocks as referencetransform blocks for an encoding target block. Here, the reconstructedneighboring blocks, which are blocks previously encoded or decoded tothereby be reconstructed, may include a block adjacent to theencoding/decoding target block, a block positioned at a right uppercorner of the encoding/decoding target block, a block positioned at aleft upper corner of the encoding/decoding target block, and/or a blockpositioned at a left lower corner of the encoding/decoding target block.Hereinafter, a block adjacent to an upper portion of the encoding targetblock will be called an upper neighboring block, and a block adjacent toa left of the encoding target block will be called a left neighboringblock. In addition, a block positioned at a right upper corner of theencoding target block will be called a right upper corner block, a blockpositioned at a left upper corner of the encoding target block will becalled a left upper corner block, and a block positioned at a left lowercorner of the encoding target block will be called a left lower cornerblock.

In the example of FIG. 6 , a block X indicates an encoding target block,and blocks A, B, C, D, E, F, and G indicate reconstructed neighboringblocks. Referring to FIG. 6 , the encoder may select at least one ofleft neighboring blocks A and B, an upper neighboring block D, rightupper corner blocks E and F, a left upper corner block G, and a leftlower corner block C as the reference transform block.

FIG. 7 is a conceptual diagram schematically showing another example ofa method of selecting a reference transform block according to anexemplary embodiment of the present invention.

710 of FIG. 7 indicates a block in an encoding target picture, and 720of FIG. 7 indicates a collocated block in a reference picture. Here, thecollocated block means a block present at a position that is thespatially same as that of a block in the encoding target picture withinthe reference picture. A block X shown in 710 of FIG. 7 indicates anencoding target block.

The encoder may determine a reference transform block for the encodingtarget block among blocks in the reference picture. Referring to FIG. 7, as an example, the encoder may select at least one of a block T 722and a block O 724 in the reference picture as the reference transformblock. Here, the block T 722 may be a collocated block for the encodingtarget block, and the block O 724 may be a collocated block for theupper neighboring block. In addition, the encoder may select the block T722 present at a position that is the spatially same as that of a blockin the encoding target picture among the blocks in the reference pictureas the reference transform block.

FIG. 8 is a conceptual diagram schematically showing still anotherexample of a method of selecting a reference transform block accordingto an exemplary embodiment of the present invention. A block X shown inFIG. 8 indicates an encoding target block.

The encoder may select blocks present at predetermined relativepositions for the encoding target block as the reference transform blockfor the encoding target block. Referring to FIG. 8 , as an example, theencoder may select at least one of a left neighboring block A adjacentto the left of the encoding target block X and an upper neighboringblock B adjacent to an upper portion of the encoding target block X asthe reference transform block for the encoding target block.

FIG. 9 is a conceptual diagram schematically showing still anotherexample of a method of selecting a reference transform block accordingto an exemplary embodiment of the present invention. A block X shown inFIG. 9 indicates an encoding target block.

The encoder may select blocks having the same size as that of theencoding target block as the reference transform block for the encodingtarget block. Here, the reference transform block may be selected amongreconstructed neighboring blocks by way of example.

Referring to FIG. 9 , the blocks having the same size as the encodingtarget block X among the reconstructed neighboring block are a leftlower corner block C, a left upper corner block G, and an upperneighboring block D. Here, the encoder may determine at least one of theleft lower corner block G, the left upper corner block G, and the upperneighboring block D having the same size as that of the encoding targetblock X as the reference transform block for the encoding target blockX.

FIG. 10 is a conceptual diagram schematically showing still anotherexample of a method of selecting a reference transform block accordingto an exemplary embodiment of the present invention. A block X shown inFIG. 10 indicates an encoding target block.

The encoder may select blocks having the same depth value as that of theencoding target block as the reference transform block for the encodingtarget block. Here, the reference transform block may be selected amongreconstructed neighboring blocks by way of example.

Referring to FIG. 10 , the blocks having the same depth value as theencoding target block X among the reconstructed neighboring block are aleft lower corner block C, a left upper corner block G, and an upperneighboring block D. Here, the encoder may determine at least one of theleft lower corner block C, the left upper corner block G, and the upperneighboring block D having the same depth value as that of the encodingtarget block X as the reference transform block for the encoding targetblock X.

FIG. 11 is a conceptual diagram schematically showing still anotherexample of a method of selecting a reference transform block accordingto an exemplary embodiment of the present invention. A block X shown inFIG. 11 indicates an encoding target block.

The encoder may select blocks having an encoding parameter equal orsimilar to that of the encoding target block as the reference transformblock for the encoding target block. Here, the reference transform blockmay be selected among reconstructed neighboring blocks by way ofexample. Here, the encoding parameter may include information that maybe inferred during an encoding or decoding process as well asinformation that is encoded in the encoder and is transmitted to thedecoder, such as a syntax element, and means information required whenthe picture is encoded or decoded. The encoding parameter may include,for example, an intra prediction direction, a block size, a referencepicture list, a reference picture index, a motion vector predictor,whether or not a motion information merge is used, whether or not a skipmode is used, a transform kind, and the like.

In the example of FIG. 11 , it is assumed that a left neighboring blockA and an upper neighboring block B among the reconstructed neighboringblocks have an encoding parameter equal or similar to that of theencoding target block X. Here, the encoder may determine at least one ofthe left neighboring block A and the upper neighboring block B as thereference transform block for the encoding target block X.

The block having the encoding parameter equal or similar to that of theencoding target block may be determined by various methods. Hereinafter,examples of the block having the encoding parameter equal or similar tothat of the encoding target block will be described.

As an example, it is likely that a block to which a reference sample ora reference pixel used for intra prediction of the encoding target blockbelongs will include information equal or similar to that of theencoding target block. Therefore, the encoder may select the block towhich the reference sample or the reference pixel used for intraprediction of the encoding target block belongs as the referencetransform block for the encoding target block.

In addition, a motion vector predictor and a motion vector predictorindex may be used for inter prediction of the encoding target block.Here, the encoder may select blocks having the same motion vectorpredictor as that of the encoding target block and the same motionvector predictor index as that of the encoding target block as thereference transform block. The selected reference transform block mayhave the same motion vector as that of the motion vector predictor forthe encoding target block as the motion vector predictor.

In addition, a reference picture index may be used for inter predictionof the encoding target block. Here, the encoder may select a blockhaving the same reference picture index as that of the encoding targetblock as the reference transform block.

In addition, a motion information merge may be used for inter predictionof the encoding target block. In the case in which the motioninformation merge is used, the encoder may use at least one of spatialmotion information derived from the reconstructed neighboring block andtemporal motion information derived from the reference picture as motioninformation of the encoding target block. Here, the spatial motioninformation and the temporal motion information may be called a mergecandidate. In the motion information merge, a merge index indicatingwhich of merge candidates is used as the motion information of theencoding target block may be used.

Here, the encoder may select a block that becomes a merge target of theencoding target block as the reference transform block for the encodingtarget block. For example, the encoder may select a block correspondingto the merge target indicated by the merge index of the encoding targetblock as the reference transform block for the encoding target block.

FIG. 12 is a flow chart schematically showing an example of a method ofderiving a scanning map for an encoding target block.

As described above, the encoder may derive the scanning map for theencoding target block using the scanning information of the referencetransform block. Here, the scanning information may include a positionof a non-zero transform coefficient in the reference transform block, avalue of the transform coefficient of the selected reference transformblock, and the like.

Referring to FIG. 12 , the encoder may determine transform coefficientflag values for positions of each transform coefficient in the referencetransform block (S1210).

As an example, a transform coefficient flag value of 1 may be allocatedto a position of a non-zero transform coefficient, and a transformcoefficient flag value of 0 may be allocated to a position of atransform coefficient that is not the non-zero transform coefficient. Inthis case, the transform coefficient flag may indicate whether or notthe transform coefficient in the reference transform block is thenon-zero transform coefficient.

In addition, in the case in which sizes of the reference transform blockand the encoding target block are different, the encoder may scale thereference transform block so as to correspond to a size of the encodingtarget block. In this case, the encoder may determine the transformcoefficient flag values with respect to the positions of each transformcoefficient in the scaled reference transform block.

A specific example of a method of determining the transform coefficientflag value will be described below.

Again referring to FIG. 12 , the encoder may derive a transformcoefficient counter map for the encoding target block (S1220).

The encoder may calculate flag counter values for the positions of eachtransform coefficient in the reference transform block, and thetransform coefficient counter map may be derived by the calculated flagcounter value. Here, the flag counter means the sum of the transformcoefficient flag values present at the same positions in a plurality ofreference transform blocks. That is, the flag counter means the sum ofthe transform coefficient flag values present at the same positions inthe case in which the plurality of reference transform blocks areoverlapped with each other.

In addition, as described above, the case in which the sizes of thereference transform block and the encoding target block are differentmay also be generated. In this case, the encoder may derive thetransform coefficient counter map using the transform coefficient flagvalue of the scaled reference transform block.

A specific example of a method of deriving the transform coefficientcounter map will be described below.

Again referring to FIG. 12 , the encoder may generate a scanning map forthe encoding target block (S1230).

The encoder may generate the scanning map by allocating scan indices toeach transform coefficient position in the counter map in a sequence inwhich a flag counter value is high, based on a zigzag scan sequence.Here, the scan index may be allocated in a sequence in which an indexvalue is low, starting from 0. In addition, in the case in which aplurality of positions having the same flag counter value are present, alow scan index value may be allocated to a transform coefficientposition at which a priority of the zigzag scan is high.

A scan index value may be allocated to a plurality of transformcoefficient positions having a flag counter value of 0 based on a zigzagscan sequence. In this case, the scan index may be allocated in thezigzag scan sequence and be allocated in a sequence in which an indexvalue is low.

When the scanning map is generated, the encoder may scan transformcoefficients of the encoding target block in a sequence in which theallocated scan index value is low. A specific example of a method ofgenerating the scanning map will be described below.

FIG. 13 is a conceptual diagram schematically showing an example of amethod of determining a transform coefficient flag value according to anexemplary embodiment of the present invention.

FIG. 13 shows an encoding target block 1310, a left neighboring block1320, and an upper neighboring block 1330. The left neighboring block1320 and the upper neighboring block 1330 indicate reference transformblocks selected by the encoder. In the example of FIG. 13 , it isassumed that each of the encoding target block 1310, the leftneighboring block 1320, and the upper neighboring block 1330 has a sizeof 4×4.

As described above, the encoder may determine the transform coefficientflag values for positions of each transform coefficient in the referencetransform block. As an example, a transform coefficient flag value of 1may be allocated to a position of a non-zero transform coefficient, anda transform coefficient flag value of 0 may be allocated to a positionof a transform coefficient that is not the non-zero transformcoefficient. In this case, the transform coefficient flag may indicatewhether or not the transform coefficient in the reference transformblock is the non-zero transform coefficient. In the example of FIG. 13 ,numbers allocated to positions of each transform coefficient in thereference transform block indicate examples of the transform coefficientflag value.

Referring to FIG. 13 , in the case of the left neighboring block 1320,the non-zero transform coefficients are present at first, second, andfourth positions in a raster scan sequence. Therefore, the transformcoefficient flag value of 1 may be allocated to the position at whichthe non-zero transform coefficient is present, and the transformcoefficient flag value of 0 may be allocated to the position at whichthe non-zero transform coefficient is not present.

Further, in the case of the upper neighboring block 1330, the non-zerotransform coefficients are present at first, second, and sixth positionsin a raster scan sequence. Therefore, the transform coefficient flagvalue of 1 may be allocated to the position at which the non-zerotransform coefficient is present, and the transform coefficient flagvalue of 0 may be allocated to the position at which the non-zerotransform coefficient is not present.

FIG. 14 is a conceptual diagram schematically showing another example ofa method of determining a transform coefficient flag value according toan exemplary embodiment of the present invention.

FIG. 14 shows an encoding target block 1410, a left neighboring block1420, and an upper neighboring block 1430. The left neighboring block1420 and the upper neighboring block 1430 indicate reference transformblocks selected by the encoder. In the example of FIG. 14 , the encodingtarget block 1410 and the left neighboring block 1420 have a size of4×4, and the upper neighboring block 1430 has a size of 8×8.

As described above, in the case in which sizes of the referencetransform block and the encoding target block are different, the encodermay scale the reference transform block so as to correspond to a size ofthe encoding target block. In this case, the encoder may determine thetransform coefficient flag values with respect to the positions of eachtransform coefficient in the scaled reference transform block.

Referring to FIG. 14 , the upper neighboring block 1430 among thereference transform blocks may have a size larger than that of theencoding target block 1410. In the case in which the reference transformblock has a size larger than that of the encoding target block, theencoder may scale the reference transform block so as to correspond tothe size (4×4) of the encoding target block. 1440 of FIG. 14 indicates ascaled reference transform block.

The encoder may determine the transform coefficient flag values withrespect to the positions of each transform coefficient in the scaledreference transform block 1440. To this end, the encoder may grouptransform coefficient flags present in the reference transform block1430 before being scaled into a plurality of groups. Here, each of thegroups may correspond to each transform coefficient position in thescaled reference transform block 1440. In this case, when at least oneof the transform coefficient flag values included in one specific groupis 1, a transform coefficient flag value of 1 may be allocated to aposition of a corresponding transform coefficient position (a transformcoefficient position in the scaled reference transform block 1440). Inaddition, when all of the transform coefficient flag values included inone specific group are 0, the transform coefficient flag value of 0 maybe allocated to a position of corresponding transform coefficientpositions (transform coefficient positions in the scaled referencetransform block 1440).

Unlike the example of FIG. 14 , the reference transform block may alsohave a size smaller that that of the encoding target block. In the casein which the reference transform block has a size smaller than that ofthe encoding target block, the encoder may scale the reference transformblock so as to correspond to the size of the encoding target block.Here, each transform coefficient flag present in the reference transformblock before being scaled may correspond to at least one transformcoefficient position present in the scaled reference transform block. Inthis case, the encoder may allocate the transform coefficient flag inthe reference transform block before being scaled to a correspondingtransform coefficient position (a transform coefficient position in thescaled reference transform block). That is, the transform coefficientflag in the reference transform block before being scaled may be scaledand then allocated to a corresponding position.

FIG. 15 is a conceptual diagram schematically showing an example of amethod of deriving a transform coefficient counter map according to anexemplary embodiment of the present invention.

In the example of FIG. 15 , it is assumed that the encoding target blockhas a size of 4×4 and reference transform blocks and transformscoefficient flag values in each reference transform block are determinedto be the same as those of the example of FIG. 13 . That is, the encoderselects a left neighboring block and an upper neighboring block as thereference transform block. Here, in the case of the left neighboringblock, it is assumed that a transform coefficient flag value of 1 isallocated to first, second, and fourth positions in a raster scansequence, and in the case of the upper neighboring block, it is assumedthat a transform coefficient flag value of 1 is allocated to first,second, and sixth positions in a raster scan sequence.

As described above, the encoder may calculate flag counter values forthe positions of each transform coefficient in the reference transformblock, and the transform coefficient counter map may be derived by thecalculated flag counter value. Here, the flag counter means the sum ofthe transform coefficient flag values present at the same positions in aplurality of reference transform blocks. That is, the flag counter meansthe sum of the transform coefficient flag values present at the samepositions in the case in which the plurality of reference transformblocks are overlapped with each other.

FIG. 15 shows an example of a transform coefficient counter map derivedaccording to the exemplary embodiment of the present invention. Asdescribed above, in the example of FIG. 15 , the transform coefficientflag value at the first and second positions of the left neighboringblock in the raster scan sequence is 1, and the transform coefficientflag value at the first and second positions of the upper neighboringblock in the raster scan sequence is 1. Therefore, the flag countervalue of the first position 1510 and the second position 1520 of thetransform coefficient counter map in the raster scan sequence may be 2.

In addition, the transform coefficient flag value of the fourth positionin the left neighboring block in the raster scan sequence is 1, and thetransform coefficient flag value of the fourth position in the upperneighboring block in the raster scan sequence is 0. Therefore, the flagcounter value of the fourth position 1530 of the transform coefficientcounter map in the raster scan sequence may be 1. In addition, thetransform coefficient flag value of the sixth position in the leftneighboring block in the raster scan sequence is 0, and the transformcoefficient flag value of the sixth position in the upper neighboringblock in the raster scan sequence is 1. Therefore, the flag countervalue of the sixth position 1540 of the transform coefficient countermap in the raster scan sequence may be 1.

Meanwhile, as described above, the case in which the sizes of thereference transform block and the encoding target block are differentmay also be generated. In this case, the encoder may derive thetransform coefficient counter map using the transform coefficient flagvalue of the scaled reference transform block.

FIG. 16 is a conceptual diagram schematically showing an example of amethod of generating a scanning map according to an exemplary embodimentof the present invention.

As described above, the encoder may generate the scanning map byallocating the scan indices to each transform coefficient position inthe counter map in a sequence in which a flag counter value is high,based on a zigzag scan sequence. In the example of FIG. 16 , it isassumed that the counter map shown in FIG. 15 is used for generating thescanning map.

1610 of FIG. 16 indicates a zigzag scan sequence. In 1610 of FIG. 16 ,numbers indicated in each transform coefficient position indicate scanindex values of the zigzag scan. In the case in which the zigzag scan isapplied, the scanning may be performed in a sequence in which the scanindex value in 1610 of FIG. 16 is low.

1620 of FIG. 16 indicates a scanning map in which scan indices areallocated, derived according to the exemplary embodiment of the presentinvention. In 1620 of FIG. 16 , numbers indicated in each transformcoefficient position indicate scan index values.

Referring to 1620 of FIG. 16 , the encoder may allocate the scan indicesto each transform coefficient position in the counter map in a sequencein which a flag counter value is high. Here, the scan index may beallocated in a sequence in which an index value is low, starting from 0.In addition, in the case in which a plurality of positions having thesame flag counter value are present, a low scan index value may beallocated to a transform coefficient position at which a priority of thezigzag scan is high.

A scan index value may be allocated to a plurality of transformcoefficient positions having a flag counter value of 0 based on a zigzagscan sequence. In this case, the scan index may be allocated to eachtransform coefficient position in the counter map in the zigzag scansequence and be allocated in a sequence in which an index value is low.

When the scanning map is generated, the encoder may scan transformcoefficients of the encoding target block in a sequence in which theallocated scan index value is low.

FIG. 17 is a conceptual diagram schematically showing an example of amethod of scanning/inverse scanning a transform coefficient of anencoding target block using a scanning map.

1710 of FIG. 17 indicates a two-dimensional transform coefficient forthe encoding/decoding target block, and 1720 of FIG. 17 indicates aone-dimensional transform coefficient arrangement corresponding to thetwo-dimensional transform coefficient. In the example of FIG. 17 , it isassumed that the scanning map shown in 1620 of FIG. 16 is used forscanning/inverse scanning.

Referring to FIG. 17 , the encoder may scan the transform coefficientsof the encoding target block in a sequence in which the scan index valueallocated to the scanning map is low. In this case, the two-dimensionaltransform coefficient 1710 of the encoding target block may be scannedand encoded in a sequence of the one-dimensional transform coefficientarrangement shown in 1720 of FIG. 17 .

For example, in FIG. 17 , since a scan index value 0 is allocated to atransform coefficient 4, the transform coefficient 4 may be firstscanned. In addition, other transform coefficients may also be scannedin a sequence in which the scan index values allocated to each transformcoefficient is low.

The decoder may perform entropy-decoding on the transform coefficient inthe sequence of the one-dimensional transform coefficient arrangementshown in 1720 of FIG. 17 during a decoding process. When theentropy-decoding is performed on the transform coefficient, the decoderperforms the inverse scanning on the transform coefficient using thescanning map, thereby making it possible to allocate the transformcoefficient to the two-dimensional decoding target block. For example,the decoder may perform inverse scanning on the decoding target block ina sequence in which the scan index value allocated to the scanning mapis low. That is, the decoder may allocate the transform coefficient tothe two-dimensional decoding target block in a sequence in which thescan index value allocated to the scanning map is low.

With the above-mentioned examples, the encoder and the decoder mayselect the reference transform block in a context-adaptive scheme usingsimilarity between the encoding/decoding target block and thereconstructed neighboring block. In this case, the encoder and thedecoder perform the scanning/inverse scanning on the transformcoefficient in the encoding/decoding target block using the scanninginformation of the selected reference transform block, thereby making itpossible to improve encoding efficiency.

In the above-mentioned exemplary embodiments, although the methods havedescribed based on a flow chart as a series of steps or blocks, thepresent invention is not limited to a sequence of steps but any step maybe generated in a different sequence or simultaneously from or withother steps as described above. Further, it may be appreciated by thoseskilled in the art that steps shown in a flow chart is non-exclusive andtherefore, include other steps or deletes one or more steps of a flowchart without having an effect on the scope of the present invention.

The above-mentioned embodiments include examples of various aspects.Although all possible combinations showing various aspects are notdescribed, it may be appreciated by those skilled in the art that othercombinations may be made. Therefore, the present invention should beconstrued as including all other substitutions, alterations andmodifications belong to the following claims.

What is claimed is:
 1. An image encoding method comprising: generating aprediction block of a current block included in a current picture basedat least in part on motion information of the current block; generatinga residual block based on the current block and the prediction block;generating a transform coefficient for the residual block bytransforming the residual block; and encoding the motion information ofthe current block and the transform coefficient, wherein the currentblock is encoded by referring to a spatially neighboring block or atemporally neighboring block, wherein the temporally neighboring blockis determined by selecting one block among maximum two candidate blocksincluded in a reference picture based on encoding parameters of themaximum two candidate blocks, the encoding parameters includingreference picture indices for the maximum two candidate blocks, thereference picture being different from the current picture, the maximumtwo candidate blocks including a collocated block of the current blockand a block spatially adjacent to the collocated block, and the encodingparameters being included in a bitstream, and wherein, in case thecurrent block is encoded by referring to the temporally neighboringblock, the temporally neighboring block has the same motion informationas the current block; wherein the residual block is generated bysubtracting the prediction block from the current block; andtransmitting the encoding parameters, as included in the bitstream, froman image encoding device to an image decoding device.
 2. The imageencoding method of claim 1, wherein the encoding the motion informationis performed by using at least one among exponential golomb,context-adaptive variable length coding (CAVLC) and context-adaptivebinary arithmetic coding (CABAC).
 3. An image decoding method,comprising: obtaining a transform coefficient of a current block;obtaining a residual block of the current block based on the transformcoefficient; generating a prediction block of the current block includedin a current picture based at least in part on reconstructed motioninformation of the current block; and reconstructing the current blockbased on the generated prediction block and the residual block of thecurrent block, wherein the current block is decoded by referring to aspatially neighboring block or a temporally neighboring block, whereinthe temporally neighboring block is determined by selecting one blockamong maximum two candidate blocks included in a reference picture basedon encoding parameters of the two blocks, the encoding parametersincluding reference picture indices for the maximum two candidateblocks, the reference picture being different from the current picture,the maximum two candidate blocks including a collocated block of thecurrent block and a block spatially adjacent to the collocated block,and the encoding parameters being included in a bitstream, wherein thecurrent block is reconstructed by adding the residual block and theprediction block; and wherein, in case the current block is decoded byreferring to the temporally neighboring block, the temporallyneighboring block has the same motion information as the current block.4. The image decoding method of claim 3, wherein the reconstructing themotion information is performed by using at least one among exponentialgolomb, context-adaptive variable length coding (CAVLC) andcontext-adaptive binary arithmetic coding (CABAC).
 5. A non-transitorycomputer-readable medium storing a bitstream that is generated by animage encoding method, the method comprising: generating a predictionblock of a current block included in a current picture based at least inpart on motion information of the current block; generating a residualblock based on the current block and the prediction block; generating atransform coefficient for the residual block by transforming theresidual block; and encoding the motion information of the current blockand the transform coefficient, wherein the current block is encoded byreferring to a spatially neighboring block or a temporally neighboringblock, wherein the temporally neighboring block is determined byselecting one block among maximum two candidate blocks included in areference picture based on encoding parameters of the maximum twocandidate blocks, the encoding parameters including reference pictureindices for the maximum two candidate blocks, the reference picturebeing different from the current picture, the maximum two candidateblocks including a collocated block of the current block and a blockspatially adjacent to the collocated block, and the encoding parametersbeing included in a bitstream, and wherein, in case the current block isencoded by referring to the temporally neighboring block, the temporallyneighboring block has the same motion information as the current block;wherein the residual block is generated by subtracting the predictionblock from the current block; and transmitting the encoding parameters,as included in the bitstream, from an image encoding device to an imagedecoding device.
 6. A non-transitory computer-readable medium storing abitstream which is received by an image decoding apparatus and decodedto reconstruct a current block included in a current picture, aprediction block of the current block being generated based at least inpart on reconstructed motion information of the current block, theprediction block being used with a residual block to reconstruct thecurrent block, wherein the current block is decoded by referring to aspatially neighboring block or a temporally neighboring block, whereinthe temporally neighboring block is determined by selecting one blockamong maximum two candidate blocks included in a reference picture basedon encoding parameters of the maximum two candidate blocks, the encodingparameters including reference picture indices for the maximum twocandidate blocks, the reference picture being different from the currentpicture, the maximum two candidate blocks including a collocated blockof the current block and a block spatially adjacent to the collocatedblock, and the encoding parameters being included in a bitstream,wherein the current block is reconstructed by adding the residual blockand the prediction block; wherein the residual block of the currentblock is obtained based on a transform coefficient, wherein, in case thecurrent block is decoded by referring to the temporally neighboringblock, the temporally neighboring block has the same motion informationas the current block.